package com.hawthorn.admin.repository.provider;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.builder.annotation.ProviderMethodResolver;

import java.util.Map;

/**
 * <p>todo 参数provider</p>
 * @author: WCZ
 * @created: 2022/7/5 11:05
 * @version v1.0.1
 */

public class SysBizConfSqlProvider implements ProviderMethodResolver {
 /***
  * <p>todo 业务参数列表分页查询</p >
  * @param page 分页
  * @param qc  * @return : java.lang.String
  * @author: wcz
  * @date: 2022/7/5 9:31
  * @version: 1.0.1
  * Modification History:
  * Date Author Version Description
  * -----------------------------------------------------------
  * 2022/7/5 wcz v1.0.1 init
  */
  public String findBizConf(Page<Map<String, Object>> page, String qc)
  {
    StringBuffer sql = new StringBuffer();
    sql.append(" select\n ");
    sql.append(" 	id,\n ");
    sql.append(" 	type,\n ");
    sql.append(" 	para_key    paraKey ,\n ");
    sql.append(" 	para_name   paraName ,\n ");
    sql.append(" 	type_name   typeName ,\n ");
    sql.append(" 	biz_type    bizType ,\n ");
    sql.append(" 	para_val1   paraVal1 ,\n ");
    sql.append(" 	para_val2  	paraVal2 ,\n ");
    sql.append(" 	para_val3  	paraVal3 ,\n ");
    sql.append(" 	para_val4  	paraVal4 ,\n ");
    sql.append(" 	para_val5   paraVal5 ,\n ");
    sql.append(" 	status \n ");
    sql.append(" from\n ");
    sql.append(" 	sys_biz_conf\n ");
    sql.append(" where\n ");
    sql.append(qc);
    sql.append("and del_flag=0");


    return sql.toString();
  }

  /***
   * <p>todo 重名校验</p >
   * @param paraKey  * @return : java.lang.String
   * @author: wcz
   * @date: 2022/7/5 9:32
   * @version: 1.0.1
   * Modification History:
   * Date Author Version Description
   * -----------------------------------------------------------
   * 2022/7/5 wcz v1.0.1 init
   */
  public String checkBizConf(String paraKey)
  {
    StringBuffer sql = new StringBuffer();
    sql.append(" select\n ");
    sql.append(" 	count(*) \n ");
    sql.append(" from\n ");
    sql.append(" 	sys_biz_conf \n ");
    sql.append(" where\n ");
    sql.append(" 	para_key= '" + paraKey + "'\n ");
    return sql.toString();
  }
  /**
   * <p>todo 导出</p >
   * @param fields 导出查询
   * @param qc  * @return : java.lang.String
   * @author: wcz
   * @date: 2022/7/5 9:35
   * @version: 1.0.1
   * Modification History:
   * Date Author Version Description
   * -----------------------------------------------------------
   * 2022/7/5 wcz v1.0.1 init
   */
  public String export(String fields,String qc)  {
    StringBuffer sql = new StringBuffer();
    sql.append("select ");
    sql.append(fields);
    sql.append(" from sys_biz_conf \n");
    sql.append("where ");
    sql.append(qc);
    return sql.toString();
  }
}
